T
CSharpTest.Net
SetList<T> Class
Members  Example  See Also  Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Collections Namespace : SetList<T> Class

Glossary Item Box

Represents an immutable collection of unique items that can be manipulated as a set, intersect/union/etc.

Object Model

SetList<T> ClassT Class

Syntax

Visual Basic (Declaration) 
Public Class SetList(Of T) 
   Implements CSharpTest.Net.Interfaces.ICloneable(Of SetList(Of T)) 

Type Parameters

T

Example

Library/Library.Test/TestSetList.cs

C#Copy Code
SetList<string> list = new SetList<string>((IEnumerable<string>)new string[] { "a", "B" });
Assert.AreEqual("a,B", String.Join(",", list.ToArray())); 
            
list = new SetList<string>(2);
Assert.AreEqual("", String.Join(",", list.ToArray()));
list.Add("a");
list.Add("B");
Assert.AreEqual("a,B", String.Join(",", list.ToArray()));

list = new SetList<string>(2, StringComparer.Ordinal);
Assert.AreEqual("", String.Join(",", list.ToArray()));
list.Add("a");
list.Add("B");
Assert.AreEqual("B,a", String.Join(",", list.ToArray()));

list = new SetList<string>(2, StringComparer.OrdinalIgnoreCase);
list.Add("a");
list.Add("B");
Assert.AreEqual("a,B", String.Join(",", list.ToArray()));

list = new SetList<string>(new string[] { "B", "a" }, StringComparer.Ordinal);
Assert.AreEqual("B,a", String.Join(",", list.ToArray()));

list = new SetList<string>((IEnumerable<string>)new string[] { "B", "a" }, StringComparer.OrdinalIgnoreCase);
Assert.AreEqual("a,B", String.Join(",", list.ToArray()));
VB.NETCopy Code
Dim list As New SetList(Of String)(DirectCast(New String() {"a", "B"}, IEnumerable(Of String)))
Assert.AreEqual("a,B", [String].Join(",", list.ToArray()))

list = New SetList(Of String)(2)
Assert.AreEqual("", [String].Join(",", list.ToArray()))
list.Add("a")
list.Add("B")
Assert.AreEqual("a,B", [String].Join(",", list.ToArray()))

list = New SetList(Of String)(2, StringComparer.Ordinal)
Assert.AreEqual("", [String].Join(",", list.ToArray()))
list.Add("a")
list.Add("B")
Assert.AreEqual("B,a", [String].Join(",", list.ToArray()))

list = New SetList(Of String)(2, StringComparer.OrdinalIgnoreCase)
list.Add("a")
list.Add("B")
Assert.AreEqual("a,B", [String].Join(",", list.ToArray()))

list = New SetList(Of String)(New String() {"B", "a"}, StringComparer.Ordinal)
Assert.AreEqual("B,a", [String].Join(",", list.ToArray()))

list = New SetList(Of String)(DirectCast(New String() {"B", "a"}, IEnumerable(Of String)), StringComparer.OrdinalIgnoreCase)
Assert.AreEqual("a,B", [String].Join(",", list.ToArray()))

Inheritance Hierarchy

System.Object
   CSharpTest.Net.Collections.SetList<T>

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys